# -*-coding: utf-8 -*-
'''
Created on 2018-7-10

@author: xubaifu

'''
import nltk
# nltk.download()
from nltk.book import *
# print(text1)
# text1.concordance("monstrous", 79, 25)
# text1.similar('monstrous')
# text2.similar('monstrous')
# text2.common_contexts(['monstrous','very'])
# text4.dispersion_plot(['citizens','democracy','freedom','duties','America'])
#text3.generate()该方法已经在demo中移除
# print(len(text3))
# sorted(set(text3))
# print(len(set(text3)))

fdist1 = FreqDist(text1)
print(fdist1)
# vocabulary1 = fdist1.keys()
# print(vocabulary1)
# print(vocabulary1[50])
print(fdist1['whale'])
print(fdist1.hapaxes())
v = set(text1)
long_words = [w for w in v if len(w) > 15]
print(sorted(long_words))
print(len(long_words))



fdist5 = FreqDist(text5)
words = [w for w in set(text5) if len(w) > 7 and fdist5[w] > 7]
# sorted(words)
print(sorted(words))
print(len(sorted(words)))






